function H=save3DHFilter(filename,n,precond)
    global verbose
    timestamp=now;
    if verbose
        fprintf('creating 3D filter on %s with n = %d and precond %d for future usage\n',datestr(timestamp),n,precond);
    end
    H=makeHFilter3D(n,precond);
    Htmp=H.filter(1:n,1:n,1:n);
    fid=fopen(filename,'w');
    if fid<0
        error('failed to open file %s for writing, filter was not created\n',filename);
    else
        fwrite(fid,n,'int');
        fwrite(fid,timestamp,'real*8');
        fwrite(fid,precond,'int');
        for i=1:n
            for j=0:i-1
                for k=0:j
                    fwrite(fid,real(Htmp(i+j*n+k*n^2)),'real*8');
                end
            end
        end
        fclose(fid);
    end
end